﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StudentIndex.aspx.cs" Inherits="OnLineExam.Web.StudentIndex" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>在线考试系统</title>
    <link href="assets/layui/2.2.5/css/layui.css" rel="stylesheet" />

    <link href="../../assets/easyui/1.5.4.4/themes/bootstrap/easyui.css" rel="stylesheet" />
    <link href="../../assets/easyui/1.5.4.4/themes/icon.css" rel="stylesheet" />

    <script src="../../assets/easyui/1.5.4.4/jquery.min.js"></script>
    <script src="../../assets/easyui/1.5.4.4/jquery.easyui.min.js"></script>
    <script src="../../assets/easyui/1.5.4.4/locale/easyui-lang-zh_CN.js"></script>
</head>
<body>
    <form id="Form1" method="post" runat="server">
        <blockquote class="layui-elem-quote">
            欢迎您
			<asp:Label
                ID="lblName" runat="server" Text="Label"></asp:Label>
            <%=DateTime.Now.ToString("yyyy-MM-dd") %>
            <a href="Login.aspx?type=out" class="layui-btn">退出系统</a>

        </blockquote>


        <blockquote class="layui-elem-quote">
            试卷:
			 
		 
			 <asp:DropDownList ID="ddlPaper" runat="server"></asp:DropDownList>
            <a href="#" class="layui-btn" id="btnStart">开始考试</a>

            <asp:Label Text="" ID="lblMessage" runat="server" ForeColor="Red" />
        </blockquote>


        <blockquote class="layui-elem-quote">
            考试记录:
		 
			<table id="tt">
            </table>
        </blockquote>
    </form>

    <script>
        var userId = '<%=User.Identity.Name%>';
        var ddlPaperId = '<%=ddlPaper.ClientID %>';
        $(function () {
            $('#tt').datagrid({
                idField: 'ID',
                url: 'Handler/exam.ashx?type=getlist&userId=' + userId, //?startIndex=0&endIndex=20  /''+ index +'/'
                singleSelect: true,
                columns: [[

                    { field: 'paper', title: '试卷' },
                    { field: 'score', title: '得分' },
                    { field: 'status', title: '状态' },
                    { field: 'examTime', title: '时间' },
                    {
                        field: 'opt', title: '查看', align: 'center',
                        formatter: function (value, rec, index) {
                            var e = '<a href="#" class="layui-btn" onclick="view(' + rec.ID + ')">查看</a> ';
                            //var d = '<a href="#" mce_href="#" onclick="del(' + index + ')">删除</a> ';
                            return e;
                        }
                    }
                ]], onDblClickRow: function (ndex, row) {
                    view(row.ID);
                },
                pagination: true, rownumbers: true
            });

            $('#btnStart').click(function () {
                var pid = $('#' + ddlPaperId).val();
                $.getJSON('handler/exam.ashx?type=startExam&uid=' + userId + '&pid=' + pid, function (rsp) {

                    if (rsp.Result) {
                        window.location.href = "UserTest.aspx?PaperId=" + pid;
                    }
                });
            });
        });
        function view(id) {
            var maxWidth = ($(window).width() - 5) + 'px';
            var maxHeight = ($(window).height() - 5) + 'px';
            layer.open({
                type: 2,
                area: [maxWidth, maxHeight],
                maxmin: true,
                content: 'view.aspx?id=' + id //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
            });
        }
    </script>
    <script src="assets/layui/2.2.5/layui.all.js"></script>
    <script>
        //Demo
        layui.use('table', function () {
            var table = layui.table;
            //table.

        });
    </script>
</body>
</html>
